package cn.iocoder.yudao.module.pay.dal.mysql.pricingrules;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.pay.dal.dataobject.pricingrules.PricingRulesDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.pay.controller.admin.pricingrules.vo.*;

/**
 * 用于支付模型翻译的价格套餐列 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface PricingRulesMapper extends BaseMapperX<PricingRulesDO> {

    default PageResult<PricingRulesDO> selectPage(PricingRulesPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PricingRulesDO>()
                .eqIfPresent(PricingRulesDO::getSourceLanguage, reqVO.getSourceLanguage())
                .eqIfPresent(PricingRulesDO::getTargetLanguage, reqVO.getTargetLanguage())
                .eqIfPresent(PricingRulesDO::getMinCharacters, reqVO.getMinCharacters())
                .eqIfPresent(PricingRulesDO::getMaxCharacters, reqVO.getMaxCharacters())
                .eqIfPresent(PricingRulesDO::getPricePer, reqVO.getPricePer())
                .eqIfPresent(PricingRulesDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(PricingRulesDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PricingRulesDO::getId));
    }

}